home *** CD-ROM | disk | FTP | other *** search
/ Amiga Developer CD 2.1 / Amiga Developer CD v2.1.iso / NDK / NDK_3.5 / Documentation / Autodocs / window_cl.doc < prev   
Encoding:
Text File  |  1999-10-29  |  21.8 KB  |  609 lines

  1. TABLE OF CONTENTS
  2.  
  3. window_cl/--datasheet--
  4. window_cl/WINDOW_GetClass
  5. window_cl/WM_CLOSE
  6. window_cl/WM_HANDLEINPUT
  7. window_cl/WM_ICONIFY
  8. window_cl/WM_OPEN
  9. window_cl/--datasheet--                               window_cl/--datasheet--
  10.  
  11.    NAME
  12.        window_cl -- create Intuition Window objects
  13.  
  14.    SUPERCLASS
  15.        rootclass
  16.  
  17.    REQUIRES
  18.        layout.gadget, drawlist.image
  19.  
  20.    DESCRIPTION
  21.        This class creates standard Intuition Windows, and intelligently
  22.        handles some ReAction house keeping for KeyBoard Control, Defer
  23.        Layout processing, etc. Window class properly handles processing
  24.        messages using shared window message ports as well as safely
  25.        closing intuition windows. Window class will also intialize
  26.        your window's parent layout group properly.
  27.        
  28.        All windowclass methods and the callback hooks you provide it are
  29.        ran in the context of the task you call windowclass from. Thus if
  30.        your application is a process, DOS is safe to use. However, 
  31.        remember the Intuition rules about DOS and IDCMP VERIFY messages.
  32.        
  33.        Window.class requires layout.gadget.
  34.        
  35.    WINDOW REFRESH
  36.        Usually, when all the graphics in your window are handled by
  37.        ReAction, you should not explicitly set the window refresh method
  38.        to either smart or simple refresh. This is a user preference
  39.        setting, and windowclass will automatically choose it. However,
  40.        if your program for some reason requires one or the other refresh
  41.        method and can not use the other, set the refresh type in your
  42.        window object creation taglist.
  43.        
  44.    BACKFILL PATTERNS
  45.        Window.class will install the default backfill pattern on any 
  46.        window for which you do not pass a pointer to a custom backfill
  47.        hook. The pattern bitmaps are cached by window.class, minimizing
  48.        memory usage.
  49.        
  50.        If your windows have elements that look bad or do not work with
  51.        a backfill pattern, install the default NULL backfill to the
  52.        layout group(s) containing them.
  53.        
  54.        The backfill installed by window.class is NOT a standard, global
  55.        window layer backfill hook. It is in fact passed to each of the
  56.        layout groups of the window, which will install it during 
  57.        refreshes. This approach was chosen because datatypes fail to
  58.        render correctly if their background has been backfilled. This
  59.        method has the side effect that a gadget that is not aware of
  60.        ReAction's method to install a backfill will only have a 
  61.        backfill during window refresh (GM_RENDER coming through from 
  62.        the parent layout), not during GM_HANDLEINPUT. To make the
  63.        class use the backfill during input handling, it should have
  64.        GA_BackFill as a settable attribute, and install that
  65.        backfill hook before erasing its imagery.
  66.  
  67.    METHODS
  68.        OM_NEW -- Passed to superclass first, defaults set, then OM_SET.
  69.  
  70.        OM_SET -- Passed to superclass first, then custom tags set.
  71.  
  72.        OM_GET -- Returns requested setting or passed to superclass
  73.  
  74.        OM_DISPOSE -- Child object disposed then passed to superclass.
  75.  
  76.        WM_OPEN -- Locks default pub screen if needed, domains child layout
  77.            group min/max size, opens window, attaches layout to window.
  78.  
  79.        WM_CLOSE -- Closes the intuition window, but does not dispose
  80.            the layout group.
  81.  
  82.        WM_ICONIFY -- Create AppIcon, and invokes WM_CLOSE.
  83.  
  84.        WM_HANDLEINPUT -- Handles IDCMP input processing, defer layout
  85.            refresh requests, and returns the item ID and Code of
  86.            and selected gadget or menu attached to the window.
  87.            Transparently handles keyboard control.
  88.  
  89.        WM_NEWPREFS -- Handles update and visual refresh of new
  90.            preference settings.
  91.  
  92.        WM_RETHINK -- Re-evaluate layout requirements and adjust
  93.            window size if needed in support of dynamicly changing
  94.            layout groups.. eg, adding, replacing and removing objects.
  95.  
  96.    ATTRIBUTES
  97.  
  98.        The following standard Intuition Window Tags are supported;
  99.  
  100.        You may set these while the window is NOT open, at NewObject()
  101.        time or SetAttrs() - between WM_CLOSE and WM_OPEN for example.
  102.  
  103.            WA_Flags
  104.            WA_NoCareRefresh
  105.            WA_SimpleRefresh
  106.            WA_SmartRefresh
  107.            WA_CloseGadget
  108.            WA_DepthGadget
  109.            WA_SizeGadget
  110.            WA_SizeBRight
  111.            WA_SizeBBottom
  112.            WA_DragBar
  113.            WA_GimmeZeroZero
  114.            WA_Borderless
  115.            WA_Activate
  116.            WA_RMBTrap
  117.            WA_Backdrop
  118.            WA_SuperBitMap
  119.            WA_BackFill
  120.            WA_PubScreen
  121.            WA_CustomScreen
  122.            WA_HelpGroup
  123.            WA_MenuHelp
  124.            WA_Zoom
  125.            WA_NotifyDepth
  126.    
  127.        You may set any of these at any time, NewObject() or SetAttrs();
  128.  
  129.            WA_Top
  130.            WA_Left
  131.            WA_InnerWidth
  132.            WA_InnerHeight
  133.            WA_Width
  134.            WA_Height
  135.            WA_Title (NOTE: Calls SetWindowTitles() if the window is open)
  136.            WA_IDCMP (NOTE: Calls ModifyIDCMP() if needed)
  137.            WA_BusyPointer (NOTE: Creates/Removes a NULL requester)
  138.  
  139.        You may GetAttr() these at any time;
  140.  
  141.            WA_Top
  142.            WA_Left
  143.            WA_InnerWidth
  144.            WA_Height
  145.            WA_Width
  146.            WA_InnerHeight
  147.            WA_PubScreen
  148.            WA_CustomScreen
  149.            WA_Title
  150.            WA_ScreenTitle
  151.            WA_Zoom
  152.  
  153.            Note well, WA_InnerHeight, and WA_InnerWidth will be 0
  154.            unless previously set until the window has been opened
  155.            atleast once. These values are not computed until the
  156.            first window open.
  157.  
  158.        These are the Window Class specific attributes.
  159.  
  160.        You may set these while the window is NOT open, at NewObject()
  161.        time or SetAttrs() - between WM_CLOSE and WM_OPEN for example.
  162.  
  163.        WINDOW_Position (UWORD)
  164.            Set the intial opening position of the window.
  165.            See Also, WINDOW_RefWindow.
  166.  
  167.                WPOS_CENTERSCREEN - Center in visible screen clip.
  168.                WPOS_CENTERMOUSE  - Center under mouse.
  169.                WPOS_TOPLEFT      - Open Top/Left, just below screen bar.
  170.                WPOS_CENTERWINDOW - Center in some other window.
  171.                WPOS_FULLSCREEN   - Open Top/Left, and fill the screen clip.
  172.  
  173.            If WINDOW_RefWindow is set, WPOS_CENTERSCREEN will center
  174.            in the refwindow, not the screen. As of 42.42, WPOS_FULLSCREEN
  175.            remains broken, window will open a minimum size.
  176.  
  177.            Applicability is (OM_NEW, OM_SET)
  178.  
  179.        WINDOW_LockWidth (ULONG)
  180.            If TRUE, lock the width of the window, ie, disallow
  181.            resizing in this orientation.
  182.  
  183.            Defaults to FALSE.
  184.  
  185.            Applicability is (OM_NEW, OM_SET)
  186.  
  187.        WINDOW_LockHeight (ULONG)
  188.            If TRUE, lock the height of the window, ie, disallow
  189.            resizing in this orientation.
  190.  
  191.            Defaults to FALSE.
  192.  
  193.            Applicability is (OM_NEW, OM_SET)
  194.  
  195.        WINDOW_SharedPort (struct MsgPort *)
  196.            Pointer to a custom UserPort this window should share.
  197.  
  198.            Defaults to NULL.
  199.  
  200.            Applicability is (OM_NEW, OM_SET, OM_GET)
  201.            
  202.        WINDOW_AppPort (struct MsgPort *)
  203.            Pointer to a MsgPort this window should use for AppMessages.
  204.            By passing this tag the window turns into an AppWindow and 
  205.            you can use the WM_ICONIFY method. WindowClass must use the
  206.            ID field of the AppMessages to identify the window to which 
  207.            the message was intended. You can use the UserData field 
  208.            yourself.
  209.            
  210.            Defaults to NULL.
  211.            
  212.            Applicability is (OM_NEW, OM_SET)
  213.            
  214.        WINDOW_AppWindow (BOOL)
  215.            By providing an AppPort and setting this to TRUE, the window 
  216.            will be made a Workbench AppWindow. If you don't set this
  217.            attribute, the AppPort will only be used to support 
  218.            iconification.
  219.            
  220.            Defaults to FALSE.
  221.            
  222.            Applicability is (OM_NEW, OM_SET)
  223.            
  224.        WINDOW_IconifyGadget (BOOL)
  225.            Set to TRUE to add an iconification gadget to the window
  226.            titlebar. Please note that currently windowclass detects
  227.            the iconify gadget being pressed by using the gadget ID
  228.            0xfffe.  Do not use this ID in your application.
  229.            
  230.            Defaults to FALSE.
  231.            
  232.            Applicability is (OM_NEW, OM_SET)
  233.  
  234.        WINDOW_BackFillName (STRPTR)
  235.            Name for the custom backfill to use instead of global CAPrefs
  236.            backfill. If you use this tag, make it a user preference.
  237.            
  238.            Defaults to NULL.
  239.            
  240.            Applicability is (OM_NEW, OM_SET)
  241.  
  242.  
  243.        It is legal and safe to set any of these at any time, OM_NEW or
  244.        OM_SET regardless of of the window being open or not, if
  245.        not applicable, the setting will be ignored.
  246.  
  247.        WA_BusyPointer (BOOL)
  248.            Set the window to a busy state. It will set busy pointer
  249.            on the window. Setting the busy state will also clear the
  250.            DeferLayout state, clearing the busy state restores the
  251.            DeferLayout state to its last value.
  252.  
  253.            This is done since, its a logical assumption if the application
  254.            is busy enough that a pointer change is waranted, then its
  255.            probably busy to respond to defer requests in a timely fashion.
  256.  
  257.            Note, the window put to sleep creating a NULL requester.
  258.            In prior versions of window class before V42.40, the layout
  259.            group was set to readonly, and menu strip removed.
  260.  
  261.            Applicability is (OM_NEW, OM_SET)
  262.  
  263.        WINDOW_Layout (Object *)
  264.        WINDOW_ParentLayout
  265.        WINDOW_ParentGroup
  266.            Pointer to the parent level layout group object which
  267.            will be added to the window.
  268.  
  269.            Note the tag has 2 aliased definitions which are now
  270.            obsolete but still supported in the include files.
  271.  
  272.            Defaults to NULL.
  273.  
  274.            Applicability is (OM_NEW, OM_SET)
  275.  
  276.        WINDOW_Zoom (BOOL)
  277.            Cause the window to to be zipped via ZipWindow().
  278.  
  279.            Applicability is (OM_NEW, OM_SET)
  280.  
  281.        WINDOW_FrontBack (BOOL)
  282.            Changes window depth arrangement via WindowToFront() or
  283.            WindowToBack(). Accepted settings;
  284.  
  285.                WT_FRONT - bring window to front.
  286.                WT_BACK  - put window to back
  287.  
  288.            Applicability is (OM_NEW, OM_SET)
  289.  
  290.        WINDOW_UserData (APTR)
  291.            Pointer to your user data. Take note, this is *NOT* the
  292.            same pointer as the Intuition Window's UserData.
  293.  
  294.            Defaults to NULL.
  295.  
  296.            Applicability is (OM_NEW, OM_SET, OM_GET)
  297.  
  298.        WINDOW_GadgetUserData (UWORD)
  299.            Determines how a gadget's UserData should be interpreted. 
  300.            If the userdata is non-null, and this setting is not 
  301.            WGUD_IGNORE, then the (hook) function will be called
  302.            when the gadget is selected.
  303.            
  304.            A function gets the hook's "object" argument in a0 and the 
  305.            "message" argument in a1.
  306.  
  307.            Possible values are;
  308.  
  309.                WGUD_HOOK   - UserData is hook pointer (struct Hook *).
  310.                WGUD_FUNC   - UserData is a pointer to function.
  311.                WGUD_IGNORE - Ignore UserData.
  312.  
  313.            Defaults to WGUD_IGNORE.
  314.  
  315.            Applicability is (OM_NEW, OM_SET)
  316.            
  317.        WINDOW_MenuUserData (UWORD)
  318.            Like the WINDOW_GadgetUserData tag, but for menus. Using
  319.            this implies that WINDOW_MenuStrip has been created with
  320.            GadTools or otherwise has a 32 bit UserData field after
  321.            each menuitem.
  322.  
  323.            Applicability is (OM_NEW, OM_SET)
  324.  
  325.        WINDOW_MenuStrip (struct Menu *)
  326.            Pointer to a menu to add to window with SetMenuStrip().
  327.            Closing the window via CA_CloseWindow, will remove
  328.            the menustrip before closing the window.  Disposing the
  329.            window does NOT free the menu strip.
  330.  
  331.            Defaults to NULL.
  332.  
  333.            Applicability is (OM_NEW, OM_SET)
  334.  
  335.        WINDOW_Window (struct Window *)
  336.            Pointer to the Intuition Window, or NULL when the
  337.            window is closed.  Take care NOT to do a CloseWindow()
  338.            or you will invalidate window.class's internal pointer
  339.            and window states.
  340.  
  341.            Applicability is (OM_GET)
  342.  
  343.        WINDOW_SigMask (ULONG)
  344.            Window signal bit mask.
  345.  
  346.            Applicability is (OM_GET)
  347.            
  348.        WINDOW_IconTitle (STRPTR)
  349.            The title of the icon when the window is iconified.
  350.            
  351.            Defaults to window title.
  352.            
  353.            Applicability is (OM_NEW, OM_SET, OM_UPDATE)
  354.           
  355.        WINDOW_Icon (struct DiskObject *)
  356.            The icon to use when iconifying. 
  357.            
  358.            Defaults to ENV:Sys/def_window.info or the default project 
  359.            window.
  360.            
  361.            Applicability is (OM_NEW, OM_SET, OM_UPDATE)
  362.  
  363.        WINDOW_GadgetHelp (BOOL)
  364.            Set to TRUE to enabled gadget help processing.
  365.            
  366.            Defaults to FALSE.
  367.            
  368.            Applicability is (OM_NEW, OM_SET, OM_UPDATE)
  369.            
  370.        WINDOW_IDCMPHook (struct Hook *)
  371.            Pointer to a Hook that should be called for IDCMP messages.
  372.            When the hook is called, the data argument points to the 
  373.            window object and message argument to the IntuiMessage.
  374.  
  375.            Defaults to NULL.
  376.  
  377.            Applicability is (OM_NEW, OM_SET)
  378.  
  379.        WINDOW_IDCMPHookBits (ULONG)
  380.            If WINDOW_IDCMPHook is set, it will be called for IDCMP 
  381.            messages matching this bit mask.
  382.  
  383.            Defaults to 0L.
  384.  
  385.            Applicability is (OM_NEW, OM_SET)
  386.  
  387.        WINDOW_AppMsgHook (struct Hook *)
  388.            Pointer to a hook that should be called for AppMessages.
  389.            When this called, the function data argument will point to 
  390.            the window object and data argument to the AppMessage.
  391.            
  392.            Defaults to NULL.
  393.            
  394.            Applicability is (OM_NEW, OM_SET)
  395.            
  396.        WINDOW_RefWindow (struct Window *)
  397.            Pointer to an Intuition window whose location will be the
  398.            reference used for WINDOW_Position rather than the screen.
  399.  
  400.            Defaults to NULL.
  401.  
  402.            Applicability is (OM_NEW, OM_SET)
  403.  
  404.  
  405.        WINDOW_InputEvent (struct InputEvent *)
  406.            Pointer to an InputEvent structure which will be valid AFTER
  407.            receiving a WHMI_RAWKEY return code from window class.
  408.            This is a "fake" event, the structure is filled in based on
  409.            the IntuiMessage and other data, and is suitable for calling
  410.            MapRawKey(), infact this is how window class handles managing
  411.            gadget keyboard control.
  412.  
  413.            Applicability is (OM_GET)
  414. window_cl/WINDOW_GetClass                           window_cl/WINDOW_GetClass
  415.  
  416.    NAME
  417.        WINDOW_GetClass -- Gets the pointer to the checkbox class.
  418.  
  419.    SYNOPSIS
  420.        window_class = WINDOW_GetClass();
  421.        D0
  422.  
  423.        Class * WINDOW_GetClass(VOID);
  424.  
  425.    FUNCTION
  426.        This function is only available in runtime linked version of the
  427.        class, window.class and is not in the compiler linker library
  428.        window_cl.lib.
  429.  
  430.        Obtains the pointer to the Window class for use with NewObject().
  431.        This function always returns a valid pointer so you do not
  432.        need to check it.  The reason is that if the library opens
  433.        fine, then the pointer returned is already setup.  (Of course
  434.        this implies that if opening the library fails, you shouldn't be
  435.        calling this.)
  436.  
  437.        Note that this function does not create the class, that is done
  438.        when the class library is opened.
  439.  
  440.    INPUTS
  441.        Nothing.
  442.  
  443.    RESULT
  444.        window_class - Pointer to the window class.
  445. window_cl/WM_CLOSE                                         window_cl/WM_CLOSE
  446.  
  447.    NAME
  448.        WM_CLOSE -- Close a window
  449.        
  450.    SYNOPSIS
  451.        DoMethod( winobj, WM_CLOSE );
  452.        
  453.    FUNCTION
  454.        Close the window of this object. The gadgets are not disposed,
  455.        only detached of a window. If the window is sharing a message
  456.        port with another window, the port will be cleaned of message
  457.        intended for this window. If the window was iconified, the icon
  458.        will be removed.
  459. window_cl/WM_HANDLEINPUT                             window_cl/WM_HANDLEINPUT
  460.  
  461.    NAME
  462.        WM_HANDLEINPUT -- IDCMP input handling method
  463.        
  464.    SYNOPSIS
  465.        result = DoMethod( winobj, WM_HANDLEINPUT, &code );
  466.        
  467.    FUNCTION
  468.        This method is used to handle the IDCMP input of a window. Call
  469.        this method when the signal bit of the window's UserPort is
  470.        set. This method will return when it encounters a message that
  471.        requires notifying your application or when the message port no
  472.        longer contains messages for the window.
  473.        
  474.        The return value is two-part. The upper word describes the
  475.        class of the event the value represents, and the lower word is
  476.        a modifier that describes the event.
  477.        
  478.        Defined class return codes are:
  479.        
  480.        WMHI_IGNORE            Ignore this event
  481.        WMHI_LASTMSG        No more messages
  482.        WMHI_CLOSEWINDOW    Close gadget hit
  483.        WMHI_GADGETUP        Gadget hit.
  484.        WMHI_INACTIVE        Window went inactive.
  485.        WMHI_ACTIVE            Window was activated.
  486.        WMHI_NEWSIZE        Window was resized.
  487.        WMHI_MENUPICK        A menu item was selected.
  488.        WMHI_MENUHELP        Help was pressed in a menu.
  489.        WMHI_GADGETHELP        A gadget sends a help message.
  490.        WMHI_ICONIFY        Window should be iconified.
  491.        WMHI_UNICONIFY        Window was deiconified.
  492.        WMHI_RAWKEY            Raw key code
  493.        WMHI_VANILLAKEY        Vanilla key code
  494.        WMHI_CHANGEWINDOW    Window moved (or depth arranged)
  495.        
  496.        The value of the lower word is defined for WMHI_GADGETUP and
  497.        WMHI_GADGETHELP as the ID of the gadget, and for WMHI_MENUPICK
  498.        and WMHI_MENUHELP as the menu code. WMHI_GAGDETHELP uses the 
  499.        special values 0 and WMHI_GADGETMASK as messages "pointer not
  500.        over your window" and "pointer over your window but not over a
  501.        gadget". 
  502.        
  503.        WMHI_RAWKEY returns the raw key ID of the key being 
  504.        pressed (to get the qualifiers also, you have to use the IDCMP
  505.        hook), and WMHI_VANILLAKEY returns the ASCII value of the key.
  506.        WMHI_VANILLAKEY is only returned when you set IDCMP_VANILLAKEY.
  507.        Windowclass itself does not need vanilla key IDCMP.
  508.        
  509.        WMHI_NEWSIZE returns some extra information in the low word:
  510.        if WMF_ZOOMED is set, the window is now in zoomed state. If
  511.        WMF_ZIPWINDOW is set, this resize was caused by either a
  512.        click of the zoom gadget or a call to ZipWindow().
  513.        
  514.        WMHI_CHANGEWINDOW is returned when the window is moved. For
  515.        resizing of the window, listen to WMHI_NEWSIZE. By setting
  516.        WA_NotifyDepth, this event will also be returned for depth
  517.        arranging. The lower word contains CWCODE_DEPTH in this case.
  518.        
  519.        WMHI_CLASSMASK masks the lower word of the result code out,
  520.        while WMHI_GADGETMASK and WMHI_MENUMASK mask out the high word,
  521.        leaving only the ID part of the result value.
  522.        
  523.        A generic application side of WM_HANDLEINPUT looks like this:
  524.        
  525.        GetAttr( WINDOW_SigMask, winobj, &wsig );
  526.        
  527.        mask = Wait(wsig);    /* maybe other signals */
  528.        
  529.        if (mask & wsig)
  530.            while ((result = DoMethod( winobj, WM_HANDLEINPUT, &code ))
  531.                    != WMHI_LASTMSG)
  532.                switch (result & WMHI_CLASSMASK)
  533.                {
  534.                case WMHI_CLOSEWINDOW:
  535.                    close = TRUE;
  536.                    break;
  537.                    
  538.                case WMHI_GADGETUP:
  539.                    switch (result & WMHI_GADGETMASK)
  540.                    {
  541.                    /* handle the gadgets here */
  542.                    }
  543.                    
  544.                /* handle whatever other events you want here */
  545.                }
  546.                
  547.        if (close)
  548.            DisposeObject( winobj ); /* destroy the window */
  549.            
  550.        If you have set up the window to use a shared message port, you
  551.        can simply call this method on each of the windows:
  552.        
  553.        if (mask & wsig)
  554.        {
  555.            WmHandleInputWin1();
  556.            WmHandleInputWin2();
  557.            WmHandleInputWin3();
  558.        }
  559.        
  560.    INPUTS
  561.        code -- A pointer to a WORD that should be set to contain the
  562.                Code value from the IntuiMessage.
  563.                
  564.    RESULTS
  565.        Windowclass will automatically respond with an appropriate
  566.        action to many input events. When it does not know what to do
  567.        with an event, it will return with a value as descibed above.
  568. window_cl/WM_ICONIFY                                     window_cl/WM_ICONIFY
  569.  
  570.    NAME
  571.        WM_ICONIFY -- Hide this window to an icon
  572.        
  573.    SYNOPSIS
  574.        DoMethod( winobj, WM_ICONIFY );
  575.        
  576.    FUNCTION
  577.        Close the window and put an icon on the Workbench for it. 
  578. window_cl/WM_OPEN                                           window_cl/WM_OPEN
  579.  
  580.    NAME
  581.        WM_OPEN -- Open a window
  582.        
  583.    SYNOPSIS
  584.        window = DoMethod( winobj, WM_OPEN );
  585.        
  586.    FUNCTION
  587.        This function opens the window the object should be handling.
  588.        If the window is already open, it does nothing. If no shared
  589.        message port is set, a message port will be created for this
  590.        window.
  591.        
  592.    RESULTS
  593.        window -- a pointer to the struct Window for this window, or
  594.                NULL if the window could not be opened.
  595. window_cl/WM_RETHINK                                     window_cl/WM_RETHINK
  596.  
  597.    NAME
  598.        WM_RETHINK -- Re-evaluate an open window's size requirement
  599.        
  600.    SYNOPSIS
  601.        window = DoMethod( winobj, WM_RETHINK );
  602.        
  603.    FUNCTION
  604.        This function re-evaluates the layout group's minimum size
  605.        and adjusts the window size to contain it if needed.
  606.        
  607.    RESULTS
  608.        Non-Zero if implemented.
  609.